package boxoffice;

import java.awt.*;
import javax.swing.*;

/**
 * ImageScroll panel displays a BufferedImage inside of a scrollable ImagePanel.
 * 
 * @author Dale Shpak
 * @version %I%, %G%
 * @since JDK 1.3
 */
public class ImageScrollFrame extends JFrame {
    /** The ImagePanel that the scroll pane is viewing */
    JScrollPane scroller = new JScrollPane();
    ImagePanel panel;
    /** Size of the ImagePanel */
    private Dimension size;
    
    /**
    * Constructor with no args creates a 400 by 300 pane.
    * @author Dale Shpak
    * @version %I%, %G%
    * @since JDK 1.3
    */	
    public ImageScrollFrame (String imageFileName) {
        this (imageFileName, new Dimension(400, 300));
    }
    
    /**
    * Construct a pane of the specified size containing an ImagePanel.
    * @author Dale Shpak
    * @version %I%, %G%
    * @param sz the size of the ImagePanel in pixels.
    * @since JDK 1.3
    */	
    public ImageScrollFrame (String imageFileName, Dimension sz) {
        super (imageFileName);
        size = sz;
        //System.out.println("ImageScrollFrame " + size.width + " by " + size.height);
        panel = new ImagePanel(imageFileName);
        scroller.setPreferredSize (size);
        //panel.setPreferredSize(size);
        scroller.setViewportView (panel);
        this.getContentPane().add(scroller);
        this.pack();
        this.setVisible(true);
    }
    
}